<script>
	export default {
		globalData: {
		      sweixin:'' 
		},
		onLaunch: function() {
			console.log('App Launch');            
			//#ifdef APP-PLUS || APP-NVUE
            self = this;
			plus.share.getServices(function(s){
				var sweixin = '';
				for(var i in s){
					if(s[i].id == 'weixin'){
						sweixin = s[i];
					}
				}
                self.globalData.sweixin = sweixin;
		    }, function(e){  
		        console.log("获取分享服务列表失败："+e.message);  
		    });
			//#endif
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			HCnavigateToMiniProgram: function(appId, path, data, cb) {
				//#ifdef APP-NVUE || APP-PLUS
                var sweixin = this.globalData.sweixin;
                //console.log(appId);
                sweixin?sweixin.launchMiniProgram({
            		id:appId,path:path,type:1,
            	}):plus.nativeUI.alert('当前环境不支持微信操作!');
                //#endif
			    //#ifdef MP-WEIXIN
			    uni.navigateToMiniProgram({
			        appId: appId,
			        //要打开的小程序 appId
			        path: path,
			        //打开的页面路径
			        extraData: data,
			        //需要传递给目标小程序的数据
			        success: function(ret) {
			            typeof cb == "function" && cb(ret);
			        },
			        fail: function(ret) {
			            typeof cb == "function" && cb(ret);
			        }
			    });
					//#endif
			},
		}
	}
</script>

<style>
	/*每个页面公共css */
</style>
